package org.piggy.core.disruptor;


import com.lmax.disruptor.WorkHandler;
import org.piggy.core.netty.processor.DefaultNettyProcessor;

public class DisruptorWorkHandler implements WorkHandler<DisruptorEvent> {

    private final DefaultNettyProcessor defaultNettyProcessor;

    public DisruptorWorkHandler(DefaultNettyProcessor nettyCoreProcessor){
        this.defaultNettyProcessor = nettyCoreProcessor;
    }

    @Override
    public void onEvent(DisruptorEvent event) {
        this.defaultNettyProcessor.process(event.getHttpRequestWrapper());
    }

}
